package com.goods.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.goods.dao.IptvUserMapper;
import com.goods.pojo.CpspBean;
import com.goods.pojo.IptvUserBean;
import com.goods.pojo.StbBean;
import com.goods.service.ICpspService;
import com.goods.service.IIptvUserService;
import com.goods.service.IStbService;
import com.somtacode.core.base.result.ResponseDataResult;

@Service
public class IptvUserServiceImpl implements IIptvUserService{

	@Autowired
	private IptvUserMapper iptvUserMapper;
	
	@Autowired 
	private IStbService stbService;
	
	@Autowired
	private ICpspService cpspService;
	
	@Override
	public ResponseDataResult addIptvUser(IptvUserBean IptvUser) {
		iptvUserMapper.addIptvUser(IptvUser);
		return ResponseDataResult.setResponseResult();
	}

	@Override
	public ResponseDataResult deleteIptvUser(Integer id) {
		iptvUserMapper.deleteIptvUser(id);
		return ResponseDataResult.setResponseResult();
	}

	@Override
	public ResponseDataResult updateIptvUser(IptvUserBean IptvUser) {
		iptvUserMapper.updateIptvUser(IptvUser);
		return ResponseDataResult.setResponseResult();
	}

	@Override
	public List<IptvUserBean> getIptvUser(Integer id) {
		return iptvUserMapper.getIptvUser(id);
	}

	@Override
	public PageInfo<IptvUserBean> listIptvUser(Integer pageNum, Integer pageSize,
			IptvUserBean IptvUser) {
		Page<IptvUserBean> page = PageHelper.startPage(pageNum,pageSize);
		this.iptvUserMapper.listIptvUser(IptvUser);
		return page.toPageInfo();
	}

	@Override
	public List<IptvUserBean> getIptvUserByUser(String userid,Integer cpspid) {
		return iptvUserMapper.getIptvUserByUser(userid,cpspid);
	}

	@Override
	public List<IptvUserBean> getIptvUserStbid(String smpStbid, String userid) {
		return iptvUserMapper.getIptvUserStbid(smpStbid,userid);
	}

	@Override
	public ResponseDataResult deleteIptvUserStbid(String userid,int cpspid) {
		iptvUserMapper.deleteIptvUserStbid(userid,cpspid);
		return ResponseDataResult.setResponseResult();
	}

}
